﻿using System;

namespace GuRenFang.Service.Entity
{
    public class StatisticsData
    {
        public int Visits { get; set; }
        public int NewVisits { get; set; }
        public int ReturningVisits
        {
            get { return Visits - NewVisits; }
        }
        public double PercentNewVisits { get; set; }
        public double PercentReturningVisits 
        { 
            get{ return 100 - PercentNewVisits; }
        }
        public DateTime AvgTimeOnSite { get; set; }

        public int Pageviews { get; set; }
        public double AvgPageviews
        {
            get { return Visits==0?0:Convert.ToDouble(Pageviews)/Visits; }
        }
        public double VisitBounceRate { get; set; }

        public int FromSearchEngine { get; set; }
        public double PercentFromSerchEngine
        {
            get { return Visits == 0 ? 0 : Convert.ToDouble(FromSearchEngine) / Visits *100; }
        }

        public int FromRecommand { get; set; }
        public double PercentFromRecommand
        {
            get { return Visits == 0 ? 0 : Convert.ToDouble(FromRecommand) / Visits * 100; }
        }

        public int FromDirect { get; set; }
        public double PercentFromDirect
        {
            get { return Visits == 0 ? 0 : Convert.ToDouble(FromDirect) / Visits * 100; }
        }
        
    }
}
